package com.bx.implatform.controller;

import com.bx.implatform.dto.friend.AddFriendApplyDTO;
import com.bx.implatform.dto.friend.AddFriendDTO;
import com.bx.implatform.result.Result;
import com.bx.implatform.result.ResultUtils;
import com.bx.implatform.service.IFriendApplyService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Stylesmile
 */
@Tag(name = "好友申请")
@RestController
@RequestMapping("/friendApply")
@RequiredArgsConstructor
public class FriendApplyController {
    private final IFriendApplyService iFriendApplyService;

    @PostMapping("/addFriendApply")
    @Operation(summary = "添加好友申请", description = "添加好友申请")
    public Result<String> addFriendApply(@RequestBody AddFriendApplyDTO addFriendApplyDTO) {
        iFriendApplyService.addFriendApply(addFriendApplyDTO);
        return ResultUtils.success();
    }

    @PostMapping("/friendApplyReply")
    @Operation(summary = "好友申请消息回复", description = "好友申请消息回复")
    public Result<String> friendApplyReply(@RequestBody AddFriendApplyDTO addFriendApplyDTO) {
        iFriendApplyService.friendApplyReply(addFriendApplyDTO);
        return ResultUtils.success();
    }

    @PostMapping("/add")
    @Operation(summary = "同意添加好友", description = "双方建立好友关系")
    public Result addFriend(@RequestBody AddFriendDTO addFriendDTO) {
        iFriendApplyService.addFriend(addFriendDTO);
        return ResultUtils.success();
    }
}
